package almacenes.modelo.entidad;

// Generated 16/02/2012 04:45:02 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * LoteGuias generated by hbm2java
 */
@Entity
@Table(name = "LOTE_GUIAS")
public class LoteGuias {
	/**
	 * 
	 */

	private long idLoteGuia;
	private Proveedor proveedor;
	private byte idEstadoLote;
	private String usuReg;
	private Date fecReg;
	private String usuAct;
	private Date fecAct;
	private Set<GuiaRemision> guiaRemisions =new HashSet(0);

	public LoteGuias() {
	}

	public LoteGuias(long idLoteGuia, Proveedor proveedor, byte idEstadoLote) {
		this.idLoteGuia = idLoteGuia;
		this.proveedor = proveedor;
		this.idEstadoLote = idEstadoLote;
	}

	public LoteGuias(long idLoteGuia, Proveedor proveedor, byte idEstadoLote,
			String usuReg, Date fecReg, String usuAct, Date fecAct,
			Set<GuiaRemision> guiaRemisions) {
		this.idLoteGuia = idLoteGuia;
		this.proveedor = proveedor;
		this.idEstadoLote = idEstadoLote;
		this.usuReg = usuReg;
		this.fecReg = fecReg;
		this.usuAct = usuAct;
		this.fecAct = fecAct;
		this.guiaRemisions = guiaRemisions;
	}

	@Id
	@Column(name = "ID_LOTE_GUIA", unique = true, nullable = false, precision = 10, scale = 0)
	
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SQ_LOTE_GUIAS")
	@SequenceGenerator(name = "SQ_LOTE_GUIAS", sequenceName = "SQ_LOTE_GUIAS",allocationSize=1)
	
	public long getIdLoteGuia() {
		return this.idLoteGuia;
	}

	public void setIdLoteGuia(long idLoteGuia) {
		this.idLoteGuia = idLoteGuia;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_PROVEEDOR", nullable = false)
	public Proveedor getProveedor() {
		return this.proveedor;
	}

	public void setProveedor(Proveedor proveedor) {
		this.proveedor = proveedor;
	}

	@Column(name = "ID_ESTADO_LOTE", nullable = false, precision = 2, scale = 0)
	public byte getIdEstadoLote() {
		return this.idEstadoLote;
	}

	public void setIdEstadoLote(byte idEstadoLote) {
		this.idEstadoLote = idEstadoLote;
	}

	@Column(name = "USU_REG", length = 10)
	public String getUsuReg() {
		return this.usuReg;
	}

	public void setUsuReg(String usuReg) {
		this.usuReg = usuReg;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "FEC_REG", length = 7)
	public Date getFecReg() {
		return this.fecReg;
	}

	public void setFecReg(Date fecReg) {
		this.fecReg = fecReg;
	}

	@Column(name = "USU_ACT", length = 10)
	public String getUsuAct() {
		return this.usuAct;
	}

	public void setUsuAct(String usuAct) {
		this.usuAct = usuAct;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "FEC_ACT", length = 7)
	public Date getFecAct() {
		return this.fecAct;
	}

	public void setFecAct(Date fecAct) {
		this.fecAct = fecAct;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "loteGuias",cascade={CascadeType.ALL})
	public Set<GuiaRemision> getGuiaRemisions() {
		return this.guiaRemisions;
	}

	public void setGuiaRemisions(Set<GuiaRemision> guiaRemisions) {
		this.guiaRemisions = guiaRemisions;
	}

	@Override
	public String toString() {
		return "LoteGuias [idLoteGuia=" + idLoteGuia + ", proveedor="
				+ proveedor + ", idEstadoLote=" + idEstadoLote + ", usuReg="
				+ usuReg + ", fecReg=" + fecReg + ", usuAct=" + usuAct
				+ ", fecAct=" + fecAct + ", guiaRemisions=" + guiaRemisions
				+ "]";
	}

}
